package com.sky.mapper.common;

import com.github.pagehelper.Page;
import com.sky.dto.CategoryPageQueryDTO;
import com.sky.pojo.Category;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface CategoryMapper {
    Page<Category> pageQuery(CategoryPageQueryDTO categoryPageQueryDTO);

    @Insert("insert into sky_take_out_new.category (type, name, sort, status, create_time, update_time, create_user, update_user) values (#{type},#{name},#{sort},#{status},#{createTime},#{updateTime},#{createUser},#{updateUser})")
    void innerSave(Category category);

    @Update("update sky_take_out_new.category set status = #{status} where id = #{id}")
    void startOrStop(@Param("status") Integer status, @Param("id") Long id);

//    @Select("select * from sky_take_out_new.category where type = #{type}")
    List<Category> list(Integer type);

    void updateCategory(Category category);

    @Delete("delete from sky_take_out_new.category where id = #{id}")
    void deleteCategory(Long id);
}
